package 基于JDK技术动态代理.案例;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class Demo {
    public static void main(String[] args) {
        SayHello sayHello = new Person();
        sayHello.sayHello();

/*        SayHello sayHello1=(SayHello)  Proxy.newProxyInstance(SayHello.class.getClassLoader(), new Class<?>[]{SayHello.class}, new InvocationHandler() {
            @Override
            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                method.invoke(sayHello,args);
                System.out.println("给方法增加功能!");
                return null;
            }
        });
        sayHello1.sayHello();*/
    }
}
